﻿using System;
using System.Web.Mvc;
using Microsoft.Practices.Unity;

using BlueSky.Web.Common;

namespace BlueSky.Web
{
    /// <summary>
    /// Base class of the controller.
    /// </summary>
    /// <typeparam name="TControllerService">Type of service class.</typeparam>    
    public abstract class ControllerBase<TControllerService> : Controller
        where TControllerService : IService
    {
        /// <summary>
        /// Service.
        /// </summary>
        [Dependency]
        public virtual TControllerService Service
        {
            get;
            set;
        }

        /// <summary>
        /// Controller name.
        /// </summary>
        public string Name
        {
            get
            {
                return Utils.GetControllerName(this);
            }
        }
    }
}